package org.bonorsoft.modules.wechat.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.bonorsoft.modules.wechat.entity.WxPicture;

import java.util.List;

public interface WxPictureMapper extends BaseMapper<WxPicture> {

    @Select("SELECT id, photo_name, create_by, create_time, update_by, update_time, order_num, remark "  +
            "FROM wx_picture ${ew.customSqlSegment}")
    IPage<WxPicture> paging(Page<WxPicture> page, @Param(Constants.WRAPPER) QueryWrapper<WxPicture> queryWrapper);

    @Select("SELECT id " +
            "FROM wx_picture " +
            "order by order_num asc")
    List<String> getIds();

    @Select("SELECT photo_link " +
            "FROM wx_picture " +
            "WHERE id = #{id}")
    String getLink(String id);

}
